package adminConfigHandler

import (
	exampleDtoApiPbAdminConfig "gitee.com/krio/ginc/example/dto/api/pb/admin/config"
	adminConfigService "gitee.com/krio/ginc/example/internal/admin/config/service"
	"github.com/gin-gonic/gin"
)

// AdminConfigList 列表
func AdminConfigList(ctx *gin.Context, req *exampleDtoApiPbAdminConfig.AdminConfigListReq) (*exampleDtoApiPbAdminConfig.AdminConfigListResp, error) {
	data, err := adminConfigService.AdminConfigList(ctx, req)
	if err != nil {
		return nil, err
	}
	return data, nil
}

// AdminConfigDetail 详情
func AdminConfigDetail(ctx *gin.Context, req *exampleDtoApiPbAdminConfig.AdminConfigDetailReq) (*exampleDtoApiPbAdminConfig.AdminConfigInfo, error) {
	data, err := adminConfigService.AdminConfigDetail(ctx, req)
	if err != nil {
		return nil, err
	}
	return data, nil
}

// AdminConfigAdd 新增
func AdminConfigAdd(ctx *gin.Context, req *exampleDtoApiPbAdminConfig.AdminConfigInfo) (*exampleDtoApiPbAdminConfig.AdminConfigAddResp, error) {
	data, err := adminConfigService.AdminConfigAdd(ctx, req)
	if err != nil {
		return nil, err
	}
	return data, nil
}

// AdminConfigUpdate 修改
func AdminConfigUpdate(ctx *gin.Context, req *exampleDtoApiPbAdminConfig.AdminConfigInfo) (*exampleDtoApiPbAdminConfig.AdminConfigAddResp, error) {
	data, err := adminConfigService.AdminConfigUpdate(ctx, req)
	if err != nil {
		return nil, err
	}
	return data, nil
}

// AdminConfigDelete 删除
func AdminConfigDelete(ctx *gin.Context, req *exampleDtoApiPbAdminConfig.AdminConfigDeleteReq) (*exampleDtoApiPbAdminConfig.AdminConfigDeleteResp, error) {
	data, err := adminConfigService.AdminConfigDelete(ctx, req)
	if err != nil {
		return nil, err
	}
	return data, nil
}
